<?php
class ListView extends Container {
	
	private $listType;
	
	public function addElement(ListElement $element, $listType = NULL) {
		
		parent::addElement($element);
		
		$this->listType = $listType == NULL ? ListType::$unorderedList : $listType;
	}
	
	protected function renderOpeningMarkup() {
		
		if ($this->listType == ListType::$unorderedList) {
			echo '<ul data-role="listview"', $this->formatAttributes(), '>';
			
		} else {
			echo '<ol data-role="listview"', $this->formatAttributes(), '>';
		}
	}
	
	protected function renderClosingMarkup() {
		if ($this->listType == ListType::$unorderedList) {
			echo '</ul>';
			
		} else {
			echo '</ol>';
		}
	}
}
?>